{% extends 'layouts/base.html' %}
{% block content %}

<div class="row">
    <div class="col-xs-12">
        <!-- PAGE CONTENT BEGINS -->
<!--        <div class="row">
            <div class="col-xs-12">
                <form action="{{ url('backend/items/index')}}" class="form-horizontal" role="form" method="post" enctype="multipart/form-data">
                    <div class="form-group{% if errors['ic_name'] is not empty %} has-error{%endif%}">
                        <label for="ic_name" class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right">物品分类名称</label>
                        <div class="col-xs-12 col-sm-4">
                            <span class="block input-icon input-icon-right">
                                <input type="text" id="ic_name" placeholder="物品分类名称" name="ic_name" class="col-xs-12" value="{{itemscategory.ic_name}}" />
                            </span>
                        </div>
                        <div class="help-block col-xs-12 col-sm-reset inline"> {% if errors['ic_name'] is not empty %}{{errors['ic_name']}}{% else %} {%endif%} </div>
                    </div>
                    
                    <div class="clearfix form-actions">
                        <div class="col-md-offset-3 col-md-9">
                            <button class="btn btn-info" type="submit">
                                <i class="ace-icon fa fa-check bigger-110"></i>
                                搜索
                            </button>
                        </div>
                    </div>
                    
                </form>
            </div>-->
        <div class="row">
            <div class="col-xs-12" style="margin-bottom: 10px;">
                        <select name="ic_id" onchange="parent.location.href=options[selectedIndex].value">
                            <option>请选择类别...</option>
                            {% for v in itemscategory %}
                            <option value="{{ url('backend/items/index/', {'ic_id':v.ic_id})}}">{{v.ic_name}}</option>
                            {%endfor%}
                        </select> 
            </div>
            <div class="col-xs-12">
                <form action="{{ url('backend/items/batch') }}" method="post">
                <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                    <thead>
                        <tr>
                            <th class="center">
                                <label class="position-relative">
                                    <input type="checkbox" class="ace" />
                                    <span class="lbl"></span>
                                </label>
                            </th>
                            <th><a href="{{ url('curr_url', {'sort':'item_id'})}}">大件物品id</a></th>
                            <th><a href="{{ url('curr_url', {'sort':'ic_name'})}}">大件物品分类</a></th>
                            <th><a href="{{ url('curr_url', {'sort':'item_name'})}}">物品名称</a></th>
                            <th><a href="{{ url('curr_url', {'sort':'price'})}}">价格</a></th>
                            <th><a href="{{ url('curr_url', {'sort':'addtime'})}}">添加时间</a></th>
                            <th></th>
                        </tr>
                    </thead>

                    <tbody>


                    {% for row in result %}
                    <tr>
                        <td class="center">
                            <label class="position-relative">
                                <input name="dels[]" value="{{row.item_id}}" type="checkbox" class="ace" />
                                <span class="lbl"></span>
                            </label>
                        </td>

                        <td> {{row.item_id}} </td>
                        <td> {{row.ic_name}} </td>
                        <td> {{row.item_name}} </td>
                        <td> {{row.price}} </td>
                        <td> {{row.addtime}} </td>

                        <td>
                            <div class="hidden-sm hidden-xs btn-group">
                                <a class="btn btn-xs btn-danger adel" href="{{url('backend/items/del', {'item_id':row.item_id})}}">
                                    <i class="ace-icon fa fa-trash-o bigger-120"></i>
                                </a>
                                <a class="btn btn-xs btn-info" href="{{url('backend/items/edit', {'item_id':row.item_id})}}">
                                    <i class="ace-icon fa fa-pencil bigger-120"></i>
                                </a>
                            </div>
                        </td>
                    </tr>
                    {% endfor %}
                    </tbody>
                </table>

                <div class="row">
                    <div class="col-xs-6"><button type="submit" class="btn btn-white btn-warning btn-bold"><i class="ace-icon fa fa-trash-o bigger-120 orange"></i>批量删除</button></div>
                    <div class="col-xs-6">
                        <div class="dataTables_paginate paging_bootstrap">
                            <ul class="pagination">
                                {{pagestr | raw}}
                            </ul>
                        </div>
                    </div>
                </div>
                </form>

            </div><!-- /.span -->
        </div><!-- /.row -->


    </div>
</div>

<!-- inline scripts related to this page -->
{% endblock %}
